package itbour.onetouchshow.activity.web;

import android.os.Bundle;
import android.view.View;

import com.lsjr.net.RequestParams;

import java.util.HashMap;

import itbour.onetouchshow.App;
import itbour.onetouchshow.base.BaseWebMvpActivity;
import itbour.onetouchshow.constants.AppConfig;
import itbour.onetouchshow.constants.AppConst;
import itbour.onetouchshow.utils.EncryptUtils;
import itbour.onetouchshow.utils.L_;

/**
 * Created by onetouch on 2017/12/1.
 */

public class MyOrderListActivity extends BaseWebMvpActivity {

    @Override
    public void loadSucceed(String result) {

    }

    @Override
    public void loadFaild(String error) {

    }


    @Override
    protected void afterCreate(Bundle savedInstanceState) {

    }

    @Override
    protected void initTitle() {
        super.initTitle();
        //setTitleText("订单详情");

        getToolBarView().getLeftimageView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                onBackPressed();
            }
        });
    }

    @Override
    protected void initView() {
        super.initView();

        /*
        *     //    device : 610,
    //    userId : 299188,
    //    pageNum : 0,
    //    pageSize : 5,
    //    states : '[10, 11, 12]',
    //    withTotalPage : 1,
        *
        * */
        //加密请求html页面
        HashMap<String, String> stringStringHashMap = new HashMap<>();
        //设备来源于android端  请求html网页device用3
        stringStringHashMap.put("device", AppConst.ANDROID_DEVICE + "");
        stringStringHashMap.put("userId", App.getUserId() + "");
        //stringStringHashMap.put("pageNum", ""+0);
        // stringStringHashMap.put("pageSize", "10");
        // stringStringHashMap.put("states", "3");
        //stringStringHashMap.put("withTotalPage", "1");
        RequestParams requestParams = EncryptUtils.transEncrytionWebViewParams(stringStringHashMap, AppConfig.GETUSERORDERLIST_V1_1);
        String url = EncryptUtils.getPrintHtmlUrl(requestParams);
        L_.e(url);
        initAgentWeb(url);
        // mAgentWeb.getJsInterfaceHolder().addJavaObject(WebConst.CONTRL,new WebInteraction());

    }


    @Override
    public void onBackPressed() {
        //L_.e("getWebView().canGoBack()"+getWebView().canGoBack());
        if (getWebView().canGoBack()) {
            getWebView().goBack();
            //getWebView().goBackOrForward(-1);
            //  getWebView().loadUrl(url);
        } else {
            super.onBackPressed();
        }

    }


    @Override
    protected void showTitle(String string) {
        initTitle(string);
    }


    protected void initTitle(String title) {
        setTitleText(title);
    }


}
